package com.sxkiler.demo.test.doclet;

import com.sun.javadoc.Doclet;

import java.util.HashMap;
import java.util.Map;

import com.sun.javadoc.*;


public class DemoDoclet extends Doclet {
    public static boolean start(RootDoc root) {
        String[][] options = root.options();
        for (String[] opt : options) {
            if (opt[0].equals("-outFile")) {
                System.out.println("outFile:" + opt[1]);
            } else if (opt[0].equals("-showMessage")) {
                System.out.println("showMessage");
            }
        }

        ClassDoc[] classes = root.classes();
        for (ClassDoc cls : classes) {
            System.out.println(cls);
            MethodDoc[] methods = cls.methods();
            for (MethodDoc meth : methods) {
                System.out.println(meth);
            }
        }
        return true;
    }
    public static int optionLength(String option) {
        Map<String, Integer> options = new HashMap<String, Integer>();
        options.put("-outFile", 2);
        options.put("-showMessage", 1);

        Integer value = options.get(option);
        if (value != null) {
            return value;
        } else {
            return 0;
        }
    }
}
